package com.infotel.cartegrise.ihm;

import java.text.ParseException;

import javax.swing.JFormattedTextField;
import javax.swing.JPanel;
import javax.swing.text.MaskFormatter;

import com.infotel.cartegrise.listeners.SaveDocumentListener;

public class PanneauEnregistrerCarteGriseImmatriculation extends JPanel {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    final JFormattedTextField tfImmatriculation1;
    final JFormattedTextField tfImmatriculation2;
    final JFormattedTextField tfImmatriculation3;

    private SaveDocumentListener saveDocumentListener;

    public PanneauEnregistrerCarteGriseImmatriculation(
            PanneauEnregistrer panneauEnregistrer) throws ParseException {
        saveDocumentListener = panneauEnregistrer.getSaveDocumentListener();

        tfImmatriculation1 = new JFormattedTextField(new MaskFormatter("UU-###-UU"));
        tfImmatriculation2 = new JFormattedTextField(new MaskFormatter("###"));
        tfImmatriculation3 = new JFormattedTextField(new MaskFormatter("UU"));

        tfImmatriculation1.setColumns(9);
        saveDocumentListener.setImmatriculationArea(tfImmatriculation1);
//        tfImmatriculation2.setColumns(3);
//        tfImmatriculation3.setColumns(2);
        


//        this.setLayout(new GridBagLayout());
//        this.add(tfImmatriculation1, new GridBagConstraints(0, 0, 1, 1, 2, 0,
//                GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
//                        0, 0, 5, 5), 0, 0));
//        this.add(new JLabelFont("-"), new GridBagConstraints(1, 0, 1, 1, 0, 0,
//                GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
//                        0, 0, 5, 5), 0, 0));
//        this.add(tfImmatriculation2, new GridBagConstraints(2, 0, 1, 1, 2, 0,
//                GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
//                        0, 0, 5, 5), 0, 0));
//        this.add(new JLabelFont("-"), new GridBagConstraints(3, 0, 1, 1, 0, 0,
//                GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
//                        0, 0, 5, 5), 0, 0));
//        this.add(tfImmatriculation3, new GridBagConstraints(4, 0, 1, 1, 2, 0,
//                GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
//                        0, 0, 5, 5), 0, 0));
        this.add(tfImmatriculation1);

    }

}
